@extends("admin.layout.main")

@section("content")
    <style>
        .error {
            color: red;
        }
    </style>

    <!--主页面头部信息-->
    <div class="page-header">
        <h1>
            转账
        </h1>
    </div>
    <div class="row">
        <div class="col-xs-12">
            <form class="form-horizontal" method="post" id="form" action="">
                <input type="hidden" name="user_id" value="{{ $userInfo->id }}">
                <div class="form-group">
                    <label class="col-sm-1 control-label no-padding-right"> 创客ID: </label>
                    <div class="col-sm-9" style="margin-top: 9px">
                        {{ $userInfo->id }}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-1 control-label no-padding-right"> 注册币: </label>
                    <div class="col-sm-9">
                        <input placeholder="请输入转账金额" name="coin_number" number="true" max="{{ $userInfo->registered_currency }}" required type="text" onchange="checkCoinNumber()">
                        可用注册币：{{ $userInfo->registered_currency }}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-1 control-label no-padding-right"> 接收人: </label>
                    <div class="col-sm-9">
                        <input placeholder="请输入接收人ID" name="receiver" required type="text">
                        请输入接收人ID
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-1 control-label no-padding-right"> 操作备注: </label>
                    <div class="col-sm-9">
                        <textarea style="resize: none;width: 400px;height: 300px;" name="reasons" maxlength="50" required></textarea>
                    </div>
                </div>
                <div class="col-md-offset-2 col-md-9">
                    <button class="btn btn-info btn-primary">
                        保存
                    </button>
                    <a class="btn" onclick="javascript:history.back(-1);">
                        取消
                    </a>
                </div>
            </form>
        </div>
    </div>
    <script src="{{ config('global.assets_path') }}js/jquery.validate.min.js"></script>
    <script src="{{ config('global.assets_path') }}js/messages_zh.js"></script>
    <script src="/plugins/layui/layui.js"></script>
    <script src="/plugins/layui/layui_component.js"></script>
    <script src="/js/ajax.js"></script>
    <script>
        function checkCoinNumber() {
            var type = $('select[name="coin_type"]').val();
            var number = $('input[name="coin_number"]').val();
            var cash = '{{ $userInfo->registered_currency }}';
            if(type == 2 && number > cash){
                $('input[name="coin_number"]').attr('max',parseFloat(cash));
            }else{
                $('input[name="coin_number"]').removeAttr('max');
            }
        }
    </script>
@endsection
